require_relative 'class_irc.rb'
require_relative 'class_modsys.rb'

class Bot

	def initialize(server, port, nick, ident, realname, ssl)
		$Server_Address = server
		$Server_Port = port
		$Bot_Nick = nick
		$Bot_Ident = ident
		$Bot_Realname = realname
		$Use_SSL = ssl
		
		$ModSys = Module_System.new
	end
	
	def Start()
		$irccon = IRC.new
		$irccon.Connect()
		self.Listener()
	end
	
	def Listener()
		while ($irccon.Read)
			$stdout.flush
			
			
			
			if ($bufferbits[0] == "PING")
				$irccon.Write("PONG "+$bufferbits[1])
			end
			
			if ($bufferbits[1] == "376")
				$irccon.Write("JOIN :#botarena")
			end
			
			$ModSys.Gateway()
			
			puts $buffer
			puts "\n\n"
			
		end
	end
	
end